home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2028 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.infi.net!usenet
  2. From: nngis@norfolk.infi.net (Greg DiGiorgio)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: c/dos memory allocation mixing ?
  5. Date: 18 Jan 1996 15:00:38 GMT
  6. Organization: Customer of InfiNet
  7. Message-ID: <4dlnam$7af@news.infi.net>
  8. References: <4dfmp4$678@thor.atcon.com>
  9. Reply-To: nngis@norfolk.infi.net
  10. NNTP-Posting-Host: h-hengest.norfolk.infi.net
  11. Mime-Version: 1.0
  12. X-Newsreader: WinVN 0.99.3
  13.  
  14. In article <4dfmp4$678@thor.atcon.com>, aa176@ccn.cs.dal.ca says...
  15. >
  16. >Is there a problem with mixing C and dos memory allocation? This is
  17. >the only thing I can think of that might be messing up my program but
  18. >I really need to do this. Any help GREATLY appreciated!!! I've had
  19. >this bug at the back of my mind for months and it's time to solve it
  20. >once and for all. I need a life again!
  21. >
  22.  
  23. How does one "mix" DOS and C memory allocation. When you use "malloc",
  24. your compiler includes the routines needed to allocate memory from DOS 
  25. within your C program. In fact, much of the code that the compiler wraps 
  26. around your program (and it's substantial) is devoted to memory 
  27. management. 
  28.  
  29. Therefore, using "malloc" does what you want. Now, if you are programming 
  30. in, say, Windows V3.1 - don't use "malloc", use the Windows routine to 
  31. alloc memory. In this case, you would be mixing DOS and 'C' memory alloc, 
  32. so to speak - and it would not be a good idea.
  33.  
  34. Hope this helps,
  35. Greg DiGiorgio
  36.  
  37.